<template>
	<view class="reviewed-coupon">
		<!-- 时间筛选 -->
		<view class="date-range">
			<uni-datetime-picker v-model="range" type="daterange" :clear-icon="false" :border="false"
				@change="maskClick" />
		</view>

		<!-- 筛选框 -->
		<view class="screen-box">
			<view class="screen-item" :class="{'active': screenIndex == index}" v-for="(item,index) in screenList"
				:key="index" @click="handleScreenToggle(index)">{{item.name}}</view>
		</view>

		<!-- 审核列表 -->
		<view class="reviewed-coupon-list">
			<checkbox-group @change="reviewedChange">
				<view class="reviewed-coupon-item">
					<checkbox class="reviewed-checkbox" color="#FFA53D" value="1" />
					<view class="coupon-info-box" @click="handleReviewedDetail">
						<view class="coupon-info-left-box">
							<image class="user-avatar" src="../../static/logo.jpg" mode="aspectFit"></image>
							<view class="coupon-info-right-box">
								<view class="user-name">Ed sheeran</view>
								<view class="user-car">湘A63NS6</view>
							</view>
						</view>

						<van-icon class="coupon-info-right-arrow" name="arrow" />
					</view>
				</view>

			</checkbox-group>
		</view>

		<view class="reviewed-btn">确认审核</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				range: [],
				beginDate: "",
				endDate: "",
				screenIndex: 0,
				screenList: [{
						id: 1,
						name: '全部'
					},
					{
						id: 2,
						name: '发放'
					},
					{
						id: 3,
						name: '退券'
					},
					{
						id: 4,
						name: '作废'
					}
				],
			}
		},
		methods: {
			maskClick(e) {
				this.beginDate = e[0] + " 00:00:00";
				this.endDate = e[1] + " 00:00:00";
				console.log('Click:', this.beginDate, this.endDate);
			},
			// 切换筛选器
			handleScreenToggle(idx) {
				this.screenIndex = idx;
			},
			reviewedChange() {},
			handleReviewedDetail() {
				uni.navigateTo({
					url: "/packageD/coupon/reviewed-coupon-detail"
				})
			},
		},
	}
</script>

<style lang="less">
	page {
		background-color: #f5f5f5;
	}

	.reviewed-coupon {
		.screen-box {
			margin: 15px 20px 0 20px;
			display: flex;
			align-items: center;

			.screen-item {
				flex: 1;
				height: 31px;
				line-height: 31px;
				text-align: center;
				font-size: 13px;
				color: rgba(0, 0, 0, 0.8);
				background-color: rgba(0, 0, 0, 0.03);
				border-radius: 4px;
				margin-left: 10px;

				&:first-child {
					margin-left: 0;
				}

				&.active {
					background-color: rgba(255, 165, 61, 0.10);
					color: #FFA53D;
					font-weight: 500;
				}
			}
		}

		.reviewed-coupon-list {
			margin: 0 20px;

			.reviewed-coupon-item {
				display: flex;
				align-items: center;
				margin-top: 20px;

				.reviewed-checkbox {
					width: 30px;
					flex: 0 0 30px;
				}

				.coupon-info-box {
					flex: 1;
					min-width: 0;
					padding: 18px 15px;
					background-color: #fff;
					border-radius: 10px;
					box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.05);
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-left: 10px;

					.coupon-info-left-box {
						flex: 1;
						display: flex;
						align-items: center;

						.user-avatar {
							width: 48px;
							height: 48px;
							border-radius: 50%;
						}

						.coupon-info-right-box {
							margin-left: 10px;

							.user-name {
								font-size: 16px;
								color: rgba(0, 0, 0, 0.80);
								font-weight: 500;
							}

							.user-car {
								font-size: 12px;
								color: rgba(101, 101, 101, 1);
								margin-top: 3px;
							}
						}
					}

					.coupon-info-right-arrow {
						font-size: 16px;
						width: 16px;
						flex: 0 0 16px;
						color: #ddd;
					}

				}
			}
		}

		.reviewed-btn {
			position: fixed;
			bottom: 60px;
			left: 20px;
			right: 20px;
			height: 44px;
			line-height: 44px;
			text-align: center;
			font-size: 16px;
			color: #fff;
			font-weight: 500;
			background-color: rgba(255, 165, 61, 1);
			box-shadow: inset 0px 4px 7px 0px rgba(255, 255, 255, 0.33);
			border-radius: 4px;
		}
	}
</style>
